function random(min,max){
    return Math.floor(Math.random()*(max-min+1)+min);
}
function createxx(){
    var imgobj = document.createElement('img');
    imgobj.src = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbbs.076299.com%2Fattachment13%2Fmonth_0910%2F0910130926400bc174a26bcf91.gif%3F48&refer=http%3A%2F%2Fbbs.076299.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642928903&t=5483d8403f9237ed966f41d9cb108aae'
    var w = window.innerWidth || document.documentElement.clientWidth;
    var h = window.innerHeight || document.documentElement.clientHeight;
    var xxsize = random(60,70);
    imgobj.width = xxsize;
    imgobj.height = xxsize;
    imgobj.style.position='absolute';
    imgobj.style.left = random(0,w-xxsize) +'px';
    imgobj.style.top = random(0,h-xxsize) +'px';
    document.body.append(imgobj);
    num-=20;
    if(num<0)num=0
    sp1obj.style.width = num + 'px';
    if(num==0){
        box2obj.style.display = 'block';
        clearInterval(t);
    }
}
function removexx(){
    document.onclick=function(evt){
    if(num>0){
    var e = evt || window.event;
    var target = e.target || e.srcElement
        if(target.nodeName === 'IMG'){
            document.body.removeChild(target);
            num+=20;
            if(num>150)num=150
            sp1obj.style.width = num + 'px';
        }
    }
    }
}
var num = 150;
var sp1obj = document.querySelector('#sp1');
var box2obj = document.querySelector('#box2');
sp1obj.style.width = 150 +'px';
var t = setInterval(createxx,2000);
removexx()